<?php

$servername = "localhost";
$username = "root";
$password = "714714";
$dbname = "xk";
 
// 创建连接
$conn = new mysqli($servername, $username, $password,$dbname);
 
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
}
//设置字符集编码
mysqli_query($conn,"set names 'UTF8'");

?>